<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<title>{echo admin_title()}</title>
<!--header-->
{template _:header}
</head>
<body>
<div class="layui-layout layui-layout-admin">
<!--top-->
{template _main_top}
<!--nav-->
{template _main_nav}
	<div class="position"><h1>微信模板消息</h1></div>
	<div class="layui-body admin-body">
		<div class="admin-content">
			<div class="layui-tab layui-tab-brief">
				<div class="layui-tab-content">
					<div class="opwindow">
						<form name="theform" id="theform" method="post" action="{echo \befen\get_url()}">
						<table class="layui-table">
							<tbody>
								<tr>
									<td class="td1">{$sys_cfg[weixin_trade_success]['title']}</td>
									<td class="td2">
										<div class="layui-input-inline"><input type="text" name="weixin_trade_success" id="weixin_trade_success" class="layui-input" style="width:440px;" value="{$sys_cfg[weixin_trade_success][value]}" placeholder=""></div>
										<div class="layui-input-inline layui-left-margin"><button type="button" id="btn-weixin_trade_success" class="layui-btn layui-btn-primary">一键添加</button></div>
									</td>
								</tr>
								<tr>
									<td class="td1">{$sys_cfg[weixin_refund_success]['title']}</td>
									<td class="td2">
										<div class="layui-input-inline"><input type="text" name="weixin_refund_success" id="weixin_refund_success" class="layui-input" style="width:440px;" value="{$sys_cfg[weixin_refund_success][value]}" placeholder=""></div>
										<div class="layui-input-inline layui-left-margin"><button type="button" id="btn-weixin_refund_success" id="image" class="layui-btn layui-btn-primary">一键添加</button></div>
									</td>
								</tr>
								<tr>
									<td class="td1">&nbsp;</td>
									<td class="td2">
										<button type="submit" name="submit" value="submit" id="submit" class="layui-btn">提交</button>
										<button type="reset" id="reset" class="layui-btn layui-btn-primary">重置</button>
									</td>
								</tr>
							</tbody>
						</table>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--footer-->
{template _:footer}
<style>
.layui-input {}
</style>
<script type="text/javascript">
$("#submit").click(function(){
	ajaxSubmit(this, "", "#theform");
});
$("#btn-weixin_trade_success").click(function(){
	$.ajax({
		type: "GET",
		dataType: "json",
		timeout: 30000,
		url: "{echo url('add_weixin_trade_success')}",
		data: {ajax:"json"},
		success: function(data){
			if(data.status == 0) {
				showAlert(data.message)
			} else {
				$("#weixin_trade_success").val(data.contents.template_id);
			}
		},
		error: function(data){
			showAlert("提交数据失败");
		},
		complete: function(){
			hideLoader();
		},
		beforeSend: function(){
			showLoader();
		}
	});
});
$("#btn-weixin_refund_success").click(function(){
	$.ajax({
		type: "GET",
		dataType: "json",
		timeout: 30000,
		url: "{echo url('add_weixin_refund_success')}",
		data: {ajax:"json"},
		success: function(data){
			if(data.status == 0) {
				showAlert(data.message)
			} else {
				$("#weixin_refund_success").val(data.contents.template_id);
			}
		},
		error: function(data){
			showAlert("提交数据失败");
		},
		complete: function(){
			hideLoader();
		},
		beforeSend: function(){
			showLoader();
		}
	});
});
</script>
</body>
</html>